package com.yonder.gocommand.dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.stereotype.Repository;

import com.yonder.gocommand.dao.IItemDAO;
import com.yonder.gocommand.entity.Item;

@Repository("ItemDao")
public class ItemDAOImpl extends HibernateTransactionManager implements IItemDAO {

	private static final Logger LOGGER = LoggerFactory.getLogger(IItemDAO.class);

	@Autowired
	private SessionFactory sessionFactory;

	@Override
	public void saveOrUpdate(Item i) {
		LOGGER.info("saveOrUpdate");
		Session session = sessionFactory.getCurrentSession();
		session.saveOrUpdate(i);
	}
}
